package com.janwen.j2ee.jdbc;

import java.util.ResourceBundle;

public class JDBCProperty {

	public static String jdbc_username = "";

	public static String jdbc_password = "";

	public static String jdbc_url = "";

	public static String jdbc_driver = "";
	private static final String WORK_MYSQL = "jdbc-mysql-work";
	private static final String HOME_MYSQL = "jdbc-mysql-home";

	private static final String JDBC_USER_KEY = "jdbc.username";
	private static final String JDBC_PASSWORD_KEY = "jdbc.password";
	private static final String JDBC_DRIVER_KEY = "jdbc.driverClassName";

	private static final String JDBC_URL_KEY = "jdbc.url";
    
	/**
	 * 
	 * @param atwork 公司mysql
	 */
	public JDBCProperty(boolean atwork){
		String mysql_config = null;
		if (atwork) {
			mysql_config = WORK_MYSQL;
		} else {
			mysql_config = HOME_MYSQL;
		}
		ResourceBundle rb = ResourceBundle.getBundle(mysql_config);
		jdbc_driver = rb.getString(JDBC_DRIVER_KEY);
		jdbc_url = rb.getString(JDBC_URL_KEY);
		jdbc_username = rb.getString(JDBC_USER_KEY);
		jdbc_password = rb.getString(JDBC_PASSWORD_KEY);
	}

}
